package com.zygh.lz.controller;

import com.zygh.lz.entity.Notice;
import com.zygh.lz.service.NoticeService;
import com.zygh.lz.stapprove.SysPcLog;
import com.zygh.lz.stapprove.ViLog;
import com.zygh.lz.vo.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class NoticeController {
    @Autowired
    private NoticeService noticeService;

    //新增公告
    @PostMapping("addNotice")
    //@SysPcLog(module = "新增公告",operation = "新增")
    public ResultBean addNotice(@RequestBody Notice notice, HttpServletRequest request){
        return noticeService.addNotice(notice);
    }
    //修改公告
    @GetMapping("updaNotice")
    //@SysPcLog(module = "修改公告",operation = "修改")
    public ResultBean updaNotice(Notice notice, HttpServletRequest request){
        return noticeService.updaNotice(notice);
    }

    //删除公告
    @GetMapping("delNotice")
    //@SysPcLog(module = "删除公告",operation = "删除")
    public ResultBean delNotice(Integer id, HttpServletRequest request){
        return noticeService.delNotice(id);
    }


    //查询所有公告
    @GetMapping("selectNotice")
    public ResultBean selectNotice(HttpServletRequest request) {
        return noticeService.selectNotice();
    }
}
